home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
admin
/
linuxcon.000
/
linuxcon
/
linuxconf-1.6
/
userconf
/
user1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-10
|
762b
|
39 lines
#include "userconf.h"
/*
Find out if a user account is of the same category than another
one.
If other == NULL, it is assumed to be a normal ordinary user.
*/
PUBLIC int USER::is_like (USER *other)
{
int ret = 0;
if (!special){
if (other == NULL){
ret = !is_admin();
}else if (!other->special){
ret = is_admin() == other->is_admin();
}
}else if (other != NULL && other->special){
ret = strcmp(shell.get(),other->getshell())==0;
}
return ret;
}
/*
Set the default information of an account from another.
*/
PUBLIC void USER::setlike (USER *other)
{
if (other != NULL){
shell.setfrom (other->getshell());
wrkdir.setfrom (other->wrkdir.get());
special = other->is_special();
uid = other->getuid();
gid = other->getgid();
}
}